package com.example.aidl;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class MyAIDLService extends Service {
    public MyAIDLService() {
    }
    /**
     * 当客户端绑定该服务的时候执行
     * @param intent
     * @return
     */
    @Override
    public IBinder onBind(Intent intent) {
        return iBinder;
    }

    private IBinder iBinder = new IMyAidlInterface.Stub() {
        @Override
        public int add(int num1, int num2) throws RemoteException {
            Log.e("=========>", "收到客户端的请求 : num1 = " + num1 + " num2 = " + num2);
            int result = num1 + num2;
            return result;
        }
    };
}
